package com.cion.shardingjdbcDemo.utils;

import io.shardingjdbc.core.keygen.DefaultKeyGenerator;

public class IdGenerator {

	private static DefaultKeyGenerator defaultKeyGenerator;
	static {
		DefaultKeyGenerator.setWorkerId((1L << 10L) - 1);
		defaultKeyGenerator = new DefaultKeyGenerator();
	}
	public static Long getId() {
		return defaultKeyGenerator.generateKey().longValue();
	}
}
